package day_2022_4_to_7.day48;

import java.util.Scanner;

/**
 * 求最大公约数
 * @author haomin
 * @date 2022/04/26 14:48
 **/
public class Day8_2_MaxComDivisor {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        for(int i = b;i > 0 ;i--){
            if((a % i == 0) && (b % i == 0)){
                System.out.println(i);
                return;
            }
        }
    }
}